package com.heima.admin.controller.v1;

import com.heima.admin.service.AdSensitiveService;
import com.heima.model.admin.dtos.ChannelDto;
import com.heima.model.admin.dtos.SensitiveDto;
import com.heima.model.admin.pojos.AdSensitive;
import com.heima.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author liuyaning
 * @version 1.0
 * @date 2021/7/30 17:29
 */
@Api(value = "敏感词管理", tags = "sensitive", description = "敏感词管理API")
@RestController
@RequestMapping("/api/v1/sensitive")
public class AdSensitiveController {

    @Autowired
    private AdSensitiveService adSensitiveService;


    @ApiOperation("分页获取敏感词列表")
    @PostMapping("/list")
    public ResponseResult findByNameAndPage(@RequestBody SensitiveDto dto){
        return adSensitiveService.list(dto);
    }
    @ApiOperation("新增敏感词")
    @PostMapping("/save")
    public ResponseResult insert(@RequestBody AdSensitive adSensitive){
        return adSensitiveService.insert(adSensitive);
    }
    @ApiOperation("更新敏感词")
    @PostMapping("/update")
    public ResponseResult update(@RequestBody AdSensitive adSensitive){
        return adSensitiveService.update(adSensitive);
    }
    @ApiOperation("删除敏感词")
    @DeleteMapping("/del/{id}")
    public ResponseResult deleteById(@PathVariable("id") Integer id){
        return adSensitiveService.deleteById(id);
    }
}
